SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwrAlumnos
AS
SELECT     dbo.tb_Alumnos.idAlumno AS ID, 
                      dbo.tb_Alumnos.Apellidos + ' ' + dbo.tb_Alumnos.Nombres + ' (' + dbo.vwrTiposDeDocumento.Descripcion + ' ' + CAST(dbo.tb_Alumnos.Documento AS VARCHAR)
                       + ')' AS Descripcion, dbo.vwrTiposDeDocumento.Descripcion AS TipoDocumento, dbo.tb_Alumnos.Documento, 
                      dbo.vwrLocalidades.Descripcion AS Localidad, 
                      dbo.tb_Alumnos.Apellidos + ' ' + dbo.tb_Alumnos.Nombres + ' (' + dbo.vwrTiposDeDocumento.Descripcion + ' ' + CAST(dbo.tb_Alumnos.Documento AS VARCHAR)
                       + ')' AS ApellidosYNombres
FROM         dbo.tb_Alumnos INNER JOIN
                      dbo.vwrTiposDeDocumento ON dbo.tb_Alumnos.Tipo = dbo.vwrTiposDeDocumento.ID INNER JOIN
                      dbo.vwrLocalidades ON dbo.tb_Alumnos.Localidad = dbo.vwrLocalidades.ID
GO
GRANT SELECT ON  [dbo].[vwrAlumnos] TO [Alumnos]
GRANT SELECT ON  [dbo].[vwrAlumnos] TO [Becas]
GRANT SELECT ON  [dbo].[vwrAlumnos] TO [CertificacionesServicios]
GRANT SELECT ON  [dbo].[vwrAlumnos] TO [Coordinaciones]
GRANT SELECT ON  [dbo].[vwrAlumnos] TO [GestionInstitucional]
GRANT SELECT ON  [dbo].[vwrAlumnos] TO [SoloVer]
GO
